package com.cloud.mapper;

import java.util.ArrayList;
import com.alibaba.fastjson.JSONObject;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.cloud.bean.User;

@Mapper
public interface UserMapper {
	
	User selectById(Integer id);
	
	User selectByName(String username);
	
	void insert(User user);

	User selectByPhone(String phone);

	User selectByInvitationcode(String invitationcode);

	String selectOrderByInvitationcode();

	ArrayList<User> selectByPage(@Param("start")Integer start, @Param("end")Integer end);

	Integer selectCount();

	ArrayList<User> selectByAgentLevel();

	ArrayList<String> selectByInvitate();

    JSONObject selectAdminByPhone(String phone);

	/**
	 * 查询用户 的下级总数
	 * @return
	 */
    Integer selectUserCount(Integer id);

	/**
	 * 查询用户 的下级信息
	 * @param start
	 * @param end
	 * @return
	 */
	ArrayList<User> selectUserByPage(@Param("id")Integer id,@Param("start")Integer start, @Param("end")Integer end);

	Integer updateOne(JSONObject params);

	Integer updateMany(JSONObject params);
}
